package error_code

import "github.com/gin-gonic/gin"

const (
	SUCCESS      = 0
	UNKNOW_ERROR = 1 //未知异常
	FAIL         = 2 //处理失败
)

func GinErrorWithMsg(c *gin.Context, ecode int, errmsg string) {
	c.JSON(200, gin.H{
		"code": ecode,
		"msg":  errmsg,
	})
	c.Abort()
}

func GinSuccessWithMsg(c *gin.Context, data interface{}) {
	c.JSON(200, data)
	c.Abort()
}
